/**  File: dot.cpp
 *   Author: Jaideep Balekar
 *           Department of Computer Science
 *           Texas A&M University
 *           315 - Programming Studio
 * Due Date: December 6th, 2009 @ 11:59pm
 * Contents: Draws the dots (food) on the map and sets its properties. 
 */
 
#include "dot.h"
#include <QGraphicsScene>
#include <QPainter>
#include <QStyleOption>

//Constructor 1

Dot::Dot()
{
    colorOfDot = QColor(255,255,0,255); //set color of the dot (yellow)
    //set height and width to 5 by default
	WIDTH_OF_DOT=5;
	HEIGHT_OF_DOT=5;
}

//Constructor 2
Dot::Dot(int width, int height)
{
   WIDTH_OF_DOT=width;
   HEIGHT_OF_DOT=height;
}

int Dot::type() const
{
    return ID_DOT;
}

//Making rectangle around the walls to detect collisions
QRectF Dot::boundingRect() const
{
    return QRectF(0,0,WIDTH_OF_DOT,WIDTH_OF_DOT);
}

//Drawing a rectangle of dimensions (WIDTH, HEIGHT)
void Dot::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
   QColor pencolor(0,0,0,0);
   painter->setBrush(colorOfDot);
   painter->setPen (pencolor);
   painter->drawEllipse(0,0,WIDTH_OF_DOT,HEIGHT_OF_DOT);
}




